package cn.csc.module.distribute.api.distributor;

import cn.csc.framework.common.pojo.CommonResult;
import cn.csc.module.distribute.api.distributor.dto.DistributorReqDTO;
import cn.csc.module.distribute.service.distributor.DistributorService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.csc.framework.common.pojo.CommonResult.success;
import static cn.csc.module.distribute.enums.ApiConstants.VERSION;

/**
 * @author 云隐
 * @date 2025/4/27
 **/
@RestController // 提供 RESTful API 接口，给 Feign 调用
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口，给 Dubbo Consumer 调用
@Validated
public class DistributorApiImpl implements DistributorApi{

    @Resource
    DistributorService distributorService;

    @Override
    public CommonResult<Boolean> pening(DistributorReqDTO reqDTO) {
        distributorService.pening(reqDTO);
        return success(true);
    }

    @Override
    public CommonResult<Boolean> withdrawable(DistributorReqDTO reqDTO) {
        distributorService.withdrawable(reqDTO);
        return success(true);
    }
}
